
<?php
include("db/connect.php");
include("funcsubstr.php");
$sqlstock= "select * from cartmaterial,ordersmaterial,material where cartmaterial.ordermat_id=ordersmaterial.ordermat_id and cartmaterial.mat_id=material.mat_id and ordersmat_status=111 and  cartmaterial.mat_id=".$_GET["mat_id"];
$querystock=mysql_query($sqlstock);
$queryname=mysql_query($sqlstock);
$resultname=mysql_fetch_array($queryname)
//echo $sqlstock;
 ?>
<h1 style="text-align:center;font-size:24px">รายการคลังวัตถุดิบ [<?php echo $resultname["mat_name"] ?>]</h1>
<table width="100%" height="132" border="0" >
<thead>
  <tr>
      <th width="15%">วันที่จัดเก็บ</th>
    <th width="15%">จำนวนเต็ม</th>
    <th width="9%">จำนวนคงเหลือ</th>
    <th width="9%">หน่วย</th>
  </tr>
  </thead>
  <tbody>
   <?php
  while($resultproduct=mysql_fetch_array($querystock)){
	   $year=substr($resultproduct["ordersmat_date"],0,4)+543;
		$month=monthconv(substr($resultproduct["ordersmat_date"],5,2));
		$day=substr($resultproduct["ordersmat_date"],8,2);
   ?>
      <td><?php echo $day.' '.$month.' '.$year?></td>
 	  <td><?php echo $resultproduct["mat_max"]?></td> 
      <td><?php echo $resultproduct["mat_qty"]?></td>
      <td><?php echo $resultproduct["mat_unit"]?></td>
  </tr>
  <?php }?>
    </tbody>
</table>
<div style="text-align:center"><input type="button" value="ย้อนกลับ" onclick="$('#listspan').load('list_stock1.php');" /></div>
<script>

</script>

